//
//  ViewController.m
//  CALayer
//
//  Created by 楼楚 on 16/3/2.
//  Copyright © 2016年 Chu Lou. All rights reserved.
//

#import "ViewController.h"
#import "progressView.h"

@interface ViewController ()
//@property(nonatomic,strong) CALayer *layer1;
@property (nonatomic, strong) progressView *progressView;
@property(nonatomic,strong) NSTimer *timer1;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.progressView = [[progressView alloc]initWithFrame:CGRectMake(30, 30, 400, 10)];
    self.progressView.layerColor = [UIColor redColor];
    [self.view addSubview:self.progressView];
//    _layer1 = [CALayer layer];
//    _layer1.backgroundColor = [UIColor redColor].CGColor;
//    _layer1.frame = CGRectMake(10, 30, 50, 10);
//    [self.view.layer addSublayer:_layer1];
//    
////    _layer1.frame = CGRectMake(10, 30, 150, 20);
    _timer1 = [NSTimer scheduledTimerWithTimeInterval:1.f target:self selector:@selector(timerEvent) userInfo:nil repeats:YES];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)timerEvent
{
    self.progressView.progress = arc4random()% 100/100.f;
//    arc4random()%:随机值
    
//    _layer1.frame = CGRectMake(10, 30, arc4random()%150, 10);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
